﻿using VSTalk.Engine.Core.Context;
using VSTalk.Engine.Core.EntitySession;
using VSTalk.Engine.Core.XmppConnection;
using VSTalk.Model;

using agsXMPP;

namespace VSTalk.Engine.Core.XmppCommunication
{
    public abstract class BaseCommunicationService
    {
        protected Client Client
        {
            get { return _connection.Client; }
        }

        protected IClientContext ClientContext
        {
            get { return AppServices.Get<ISessionModel>().GetClientContext(Client); }
        }

        protected IModelContext ModelContext
        {
            get { return AppServices.Get<IModelContext>(); }
        }

        protected XmppClientConnection Connection
        {
            get { return _connection.Connection; }
        }

        private IClientConnection _connection;

        public virtual void Initialize(IClientConnection connection)
        {
            _connection = connection;
        }
    }
}